<template name='contactChatHistory'>
	{{#if isReady}}
		{{#if canSearch}}
			<div class="control rocket-search-input contact-chat-history-search-wrapper">
				<form class="search-form" role="form">
					<div class="rc-input">
						<label class="rc-input__label">
							<div class="rc-input__wrapper">
								<div class="rc-input__icon">
									{{> icon block="rc-input__icon-svg" icon='magnifier'}}
								</div>
								<input type="text" class="rc-input__element" name="chat-search" id="chat-search" placeholder="{{_ 'Search_Chat_History'}}" autocomplete="off" aria-label="{{_ 'Search_Chat_History'}}" />
							</div>
						</label>
					</div>
				</form>
			</div>
		{{/if}}
		<div class="rocket-search-result">
			{{#if hasChatHistory}}
				<div class="flex-tab__result js-list">
					<ul class='list clearfix'>
						{{#each item in history}}
							{{> contactChatHistoryItem item}}
						{{/each}}
					</ul>
				</div>
			{{else}}
				<div class="contact-chat-history-search-empty">
					{{#if isSearching}}
						<h2>{{_ "No_results_found"}}</h2>
					{{else}}
						<h2>{{_ "No_previous_chat_found"}}</h2>
					{{/if}}
				</div>
			{{/if}}
		</div>
	{{else}}
		{{> loading}}
	{{/if}}
	{{#if showChatHistoryMessages}}
		<div class="rc-user-info-container flex-nav">
			{{> contactChatHistoryMessages (chatHistoryMessagesContext)}}
		</div>
	{{/if}}
</template>
